package com.example.dbsample.model.ro;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.example.dbsample.annotation.BeanFieldAnnotation;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

@Data
@ApiModel("条件请求参数")
public class ConditionRequest extends BaseRequest {
    @NotNull(groups = {Update.class}, message = "请求参数缺少id")
    private Long conditionId;

    @BeanFieldAnnotation(desc = "条件名称", isCnName = true)
    @Length(max = 256, groups = {Create.class, Update.class}, message = "名字太长")
    private String conditionName;

    @BeanFieldAnnotation(desc = "条件类型", filedType = "Integer", isMapping = true, mappingMapStr = "{\"2\":\"常规变量比较条件\",\"1\":\"复合条件\"}")
    @TableField(value = "condition_type")
    private Integer conditionType;

    @NotNull(message = "请求参数确实展示类型", groups={Create.class, Update.class})
    private Integer showType;

    @BeanFieldAnnotation(desc = "条件配置")
    @NotNull(message = "请求参数缺少配置信息", groups={Create.class, Update.class})
    private JSONObject configs;

    private String createdBy;
}
